//
//  PayNoticeView.swift
//  TrafficViolation
//
//  Created by eaglelive on 2017/6/26.
//  Copyright © 2017年 eaglelive. All rights reserved.
//

import Foundation
import UIKit
class PayNoticeView: UIView{
    var noticeImg:UIImage!
    var messText = "" ,moneyText = ""
    override func layoutSubviews() {
        super.layoutSubviews()
        let pnc = PayNoticeContoller()
        let backgroundView = UIView.init(frame: CGRect(x: 0, y: 0, width: sd_width, height: sd_height))
        backgroundView.layer.masksToBounds = true
        self.addSubview(backgroundView)
        let noticeImgView = UIImageView(image: UIImage(named: "weixin"))
        noticeImgView.image = noticeImg
        backgroundView.addSubview(noticeImgView)
        noticeImgView.snp.makeConstraints { (make) in
            make.centerX.equalTo(backgroundView.snp.centerX)
            make.width.height.equalTo(42)
            make.top.equalTo(40)
        }
        let messLabel = UILabel()
        messLabel.text = "\(messText)"
        messLabel.font =  UIFont.systemFont(ofSize: 15)
        messLabel.textColor = appMainColor
        messLabel.textAlignment = .center
        backgroundView.addSubview(messLabel)
        messLabel.snp.makeConstraints { (make) in
            make.top.equalTo(noticeImgView.snp.bottom).offset(15)
            make.width.equalTo(sd_width)
            make.height.equalTo(30)
        }
        let moneyLabel = UILabel()
        moneyLabel.text = "\(moneyText)元"
        moneyLabel.font =  UIFont.systemFont(ofSize: 17)
        moneyLabel.textAlignment = .center
        moneyLabel.font = UIFont.boldSystemFont(ofSize: 20)
        backgroundView.addSubview(moneyLabel)
        moneyLabel.snp.makeConstraints { (make) in
            make.top.equalTo(messLabel.snp.bottom)
            make.width.equalTo(sd_width)
            make.height.equalTo(cellH)
        }
        let finishBtn = UIButton()
        finishBtn.setTitleColor(appMainColor, for: .normal) //普通状态下文字的颜色
        finishBtn.setTitle("完成", for:.normal)
        finishBtn.titleLabel?.font = UIFont.systemFont(ofSize: 14)
        finishBtn.layer.borderWidth = 1
        finishBtn.layer.cornerRadius = 5
        finishBtn.layer.borderColor = colorFromHex(0xeeeeee).cgColor
        finishBtn.addTarget(pnc, action: #selector(pnc.finishPayFun), for: UIControlEvents.touchUpInside)
        backgroundView.addSubview(finishBtn)
        finishBtn.snp.makeConstraints { (make) in
            make.top.equalTo(moneyLabel.snp.bottom).offset(10)
            make.centerX.equalTo(backgroundView.snp.centerX)
            make.width.equalTo(60)
            make.height.equalTo(30)
        }
    }
}
